package it.fuesi.expired.adapters.base;

import java.io.InputStream;

import it.fuesi.expired.model.Attachment;
import it.fuesi.expired.model.base.IModel;
import it.fuesi.expired.model.base.ModelCollection;

public interface IAdapterSession {

	public void close() throws AdapterException;
	
	public <T extends IModel> ModelCollection<T> getAll(Class<T> model) throws AdapterException;
	 
	public <T extends IModel> T put(T model) throws AdapterException;
	
	public <T extends IModel> T update(T model) throws AdapterException;

	public <T extends IModel> T get(Class<T> model, String _id) throws AdapterException;

	public void delete(Class<? extends IModel> model, String _id) throws AdapterException;
	
	public void delete(Class<? extends IModel> model) throws AdapterException;
	
	public <T extends IModel>  ModelCollection<T> find(Class<T> model, IAdapterQuery<?> query) throws AdapterException;
	
	public Attachment putFile(Attachment attachment, byte[] data) throws AdapterException;
	
	public byte[] getFile(String _id) throws AdapterException;
	
	public void deleteFile(String _id) throws AdapterException;
	
	public void cleanFiles() throws AdapterException;
	
}
